using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using OpenComposite.Base;
using OpenComposite.HumanActivity.Contracts.Participants;
using OpenComposite.DesignerControls;
using OpenComposite.EII.Repository;

namespace OpenComposite.EII.Forms
{
	#region enum ParticipantIndex

	internal enum ParticipantIndex : int
	{
		Org = 0,
		OrgUnit = 1,
		Role = 2,
		User = 3,
		Activity = 4,
		Email = 5,
		Property = 6,
		ParticipantRule = 7
	}

	#endregion enum ParticipantIndex

	/// <summary>
	/// Summary description for FormParticipants.
	/// </summary>
	public class FormParticipants : System.Windows.Forms.Form
	{
		#region Members

		#region Private Vars

		/// <summary>
		/// Get a value that indicates whether the user has aborted.
		/// </summary>
		private bool m_Aborted = true;

		/// <summary>
		/// List of participants;
		/// </summary>
		private Participants m_Participants;
		private Panel panHuman;
		private Panel panOrg;
		private ToolStrip toolStripMain;
		private ToolStripButton tsbtnOK;
		private ToolStripButton tsbtnCancel;
		private Panel pnlButtons;
		private SplitContainer splitContainer1;
		private ToolStripSeparator toolStripSeparator1;
		private ToolStripButton tsbtnEmail;
		private ToolStripButton tsbtnProperty;
		private ToolStripButton tsbtnActOwner;
		private ToolStripButton tsbtnAddParticipantRule;
		private ContextMenuStrip contextSelected;
		private ToolStripMenuItem tsmiRemove;

		/// <summary>
		/// 
		/// </summary>
		private Repository.BusinessPolicy _participantPolicy;

		#endregion Private Vars

		#region Private Methods

		/// <summary>
		/// Close the dialog form.
		/// </summary>
		private void closeForm()
		{
			lstParticipants.Items.Clear();
			rdoScopeFirst.Checked = false;
			rdoScopeAll.Checked = false;
			this.Close();
		}

		/// <summary>
		/// Add a participant to the list box.
		/// </summary>
		/// <param name="participant">A participant.</param>
		private void addParticipant(IParticipant participant)
		{
			if ( participant == null )
				return;

			foreach ( ListViewItem item in lstParticipants.Items ) {
				if ( item.Tag != null && ( item.Tag as IParticipant ).Equals(participant) )
					return;
			}

			lstParticipants.BeginUpdate();
			ListViewItem itm = new ListViewItem(participant.Display);
			itm.Tag = participant;
			itm.ImageIndex = getImgIndex(participant);
			lstParticipants.Items.Add(itm);
			lstParticipants.EndUpdate();
		}

		/// <summary>
		/// Get the imagelist index of participant type.
		/// </summary>
		/// <param name="participant">IParticipant object.</param>
		/// <returns>Index in imagelist.</returns>
		private int getImgIndex(IParticipant participant)
		{
			if ( participant is Organization ) return (int)ParticipantIndex.Org;
			if ( participant is OrganizationalUnit ) return (int)ParticipantIndex.OrgUnit;
			if ( participant is Role ) return (int)ParticipantIndex.Role;
			if ( participant is User ) return (int)ParticipantIndex.User;
			if ( participant is ActivityParticipant ) return (int)ParticipantIndex.Activity;
			if ( participant is EmailParticipant ) return (int)ParticipantIndex.Email;
			if ( participant is PropertyParticipant ) return (int)ParticipantIndex.Property;
			if ( participant is RepositoryBusinessRule ) return (int)ParticipantIndex.ParticipantRule;
			return -1;
		}

		/// <summary>
		/// Add selected items from OrgSelectControl to list of participants.
		/// </summary>
		private void addSelectedItemsFromOrgControl()
		{
			foreach ( IParticipant part in orgControl1.SelectedItems ) {
				addParticipant(part);
			}
		}

		#endregion Private Methods

		#region Eventhandlers

		private void tsbtnOK_Click(object sender, EventArgs e)
		{
			btnOk_Click(btnOk, e);
		}

		private void tsbtnCancel_Click(object sender, EventArgs e)
		{
			btnCancel_Click(btnCancel, e);
		}
		/// <summary>
		/// Ok Button.
		/// </summary>
		private void btnOk_Click(object sender, System.EventArgs e)
		{
			if ( m_Participants == null ) m_Participants = new Participants();

			m_Participants.Clear();
			foreach ( ListViewItem item in lstParticipants.Items ) {
				m_Participants.Add(item.Tag as IParticipant);
			}
			orgControl1.Reset();
			m_Aborted = false;
			this.DialogResult = DialogResult.OK;
			closeForm();
		}

		/// <summary>
		/// Cancel Button.
		/// </summary>
		private void btnCancel_Click(object sender, System.EventArgs e)
		{
			orgControl1.Reset();
			m_Aborted = false;
			this.DialogResult = DialogResult.Cancel;
			closeForm();
		}

		/// <summary>
		/// Add button.
		/// </summary>
		private void btnAdd_Click(object sender, System.EventArgs e)
		{
			addSelectedItemsFromOrgControl();
		}

		/// <summary>
		/// Remove button.
		/// </summary>
		private void btnRemove_Click(object sender, System.EventArgs e)
		{
			foreach ( ListViewItem item in lstParticipants.SelectedItems ) {
				lstParticipants.Items.Remove(item);
			}
		}

		/// <summary>
		/// Email Button.
		/// </summary>
		private void btnEmail_Click(object sender, System.EventArgs e)
		{
			FormInput form = new FormInput(new EmailParticipant());
			form.ShowDialog();
			if ( form.Participant != null )
				addParticipant(form.Participant);
		}

		/// <summary>
		/// 
		/// </summary>
		private void btnProperty_Click(object sender, System.EventArgs e)
		{
			FormInput form = new FormInput(new PropertyParticipant());
			form.ShowDialog();
			if ( form.Participant != null )
				addParticipant(form.Participant);
		}

		/// <summary>
		/// Activity Owner Button.
		/// </summary>
		private void btnOwner_Click(object sender, System.EventArgs e)
		{
			//if ( m_Data.Process != null ) {
			//    FormSelectActivity form = new FormSelectActivity(m_Data.Process.Activities);
			//    form.ShowDialog();
			//    if ( form.SelectedActivity != null )
			//        addParticipant(form.SelectedActivity);
			//}
		}

		/// <summary>
		/// Prevent form from closing.
		/// </summary>
		private void FormParticipants_Closing(object sender, System.ComponentModel.CancelEventArgs e)
		{
			//			e.Cancel = true;
		}

		/// <summary>
		/// Dragenter.
		/// </summary>
		private void lstParticipants_DragEnter(object sender, DragEventArgs e)
		{
			e.Effect = DragDropEffects.Move;
		}

		/// <summary>
		/// Dragover on participants list.
		/// </summary>
		private void lstParticipants_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
		{
			e.Effect = DragDropEffects.Move;
		}

		/// <summary>
		/// Dragdrop on participants list.
		/// </summary>
		private void lstParticipants_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
		{
			addSelectedItemsFromOrgControl();
		}

		private void contextSelected_Opening(object sender, CancelEventArgs e)
		{
			Point pt = lstParticipants.PointToClient(Cursor.Position);
			ListViewHitTestInfo lvhti = lstParticipants.HitTest(pt);
			if ( lvhti.Item != null ) {
				e.Cancel = false;
			} else {
				e.Cancel = true;
			}
		}

		private void tsmiRemove_Click(object sender, EventArgs e)
		{
			foreach ( ListViewItem item in lstParticipants.SelectedItems ) {
				lstParticipants.Items.Remove(item);
			}
		}

		private void tsbtnAddParticipantRule_Click(object sender, EventArgs e)
		{
			if ( _participantPolicy == null ) {
				MessageBox.Show(
					string.Format("No participant policy available.{0}" +
						"To create one go to the Participant Policy tab of the workflow designer.", Environment.NewLine),
					this.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
				return;
			}
			OpenComposite.EII.Forms.FormSelectRepositoryEx frm = new OpenComposite.EII.Forms.FormSelectRepositoryEx(_participantPolicy);
			frm.ParentItem = _participantPolicy;
			frm.AllowChangeType = false;
			frm.AllowChangeDomain = false;
			frm.AllowCreateNewItem = false;
			frm.ShowAllDomains = false;
			frm.ShowParentItemOnly = true;
			frm.AllowedTypes = new OpenComposite.EII.Repository.ItemType[] { OpenComposite.EII.Repository.ItemType.BRule };
			frm.RepositoryID = Global.Status.CurrentRepositoryId;
			frm.DomainID = Global.Status.CurrentDomainId;
			frm.MultiSelect = false;

			if ( frm.ShowDialog() == DialogResult.OK ) {
				Repository.RepositoryBusinessRule brule = frm.SelectedItem as Repository.RepositoryBusinessRule;
				if ( brule != null ) {
					addParticipant(brule);
				}
			}
		}

		#endregion Eventhandlers

		#endregion Members

		#region Interface

		#region Properties

		/// <summary>
		/// Get a value that indicates whether the user has aborted.
		/// </summary>
		public bool Aborted
		{
			get { return m_Aborted; }
		}

		/// <summary>
		/// Get the list of participants.
		/// </summary>
		public Participants Participants
		{
			get { return m_Participants; }
		}

		/// <summary>
		/// Enable scoping radio buttons.
		/// </summary>
		public bool EnableScoping
		{
			set
			{
				rdoScopeFirst.Enabled = value;
				rdoScopeAll.Enabled = value;
			}
		}

		/// <summary>
		/// Radiobutton scope first.
		/// </summary>
		public RadioButton ScopeFirst
		{
			get { return rdoScopeFirst; }
		}

		/// <summary>
		/// Get the OrgSelectControl.
		/// </summary>
		public CtrlSelectParticipant OrgControl
		{
			get { return orgControl1; }
		}

		#endregion Properties

		#region Methods

		/// <summary>
		/// Open the participant form.
		/// </summary>
		/// <param name="participants">List of participants.</param>
		public void Init(Participants participants)
		{
			m_Participants = participants;
			lstParticipants.Clear();
			foreach ( IParticipant p in m_Participants ) {
				addParticipant(p);
			}

			rdoScopeAll.Checked = !rdoScopeFirst.Checked;
			tsbtnAddParticipantRule.Enabled = false;
		}
		public void Init(Participants participants, Repository.BusinessPolicy participantPolicy)
		{
			_participantPolicy = participantPolicy;

			m_Participants = participants;
			lstParticipants.Clear();
			foreach ( IParticipant p in m_Participants ) {
				addParticipant(p);
			}

			rdoScopeAll.Checked = !rdoScopeFirst.Checked;
			tsbtnAddParticipantRule.Enabled = true;
		}

		#endregion Methods

		#endregion Interface

		#region Contstructors

		/// <summary>
		/// Create a form object.
		/// </summary>
		/// <param name="designControl">Design control object.</param>
		public FormParticipants()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();
			btnProperty.Visible = false;
			tsbtnProperty.Visible = false;
			tsbtnEmail.Visible = false;

			lstParticipants.SmallImageList = orgControl1.Images;

			this.orgControl1.Init();
		}

		#endregion Constructors

		#region Systemstuff

		private System.Windows.Forms.Button btnAdd;
		private System.Windows.Forms.Button btnCancel;
		private System.Windows.Forms.Button btnOk;
		private System.Windows.Forms.Button btnEmail;
		private System.Windows.Forms.Button btnProperty;
		private System.Windows.Forms.Button btnOwner;
		private System.Windows.Forms.Button btnRemove;
		private System.Windows.Forms.RadioButton rdoScopeFirst;
		private System.Windows.Forms.RadioButton rdoScopeAll;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.ListView lstParticipants;
		private CtrlSelectParticipant orgControl1;
		private IContainer components = null;

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose(bool disposing)
		{
			if ( disposing ) {
				if ( components != null ) {
					components.Dispose();
				}
			}
			base.Dispose(disposing);
		}


		#region Windows Form Designer generated code

		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormParticipants));
			this.toolStripMain = new System.Windows.Forms.ToolStrip();
			this.tsbtnOK = new System.Windows.Forms.ToolStripButton();
			this.tsbtnCancel = new System.Windows.Forms.ToolStripButton();
			this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
			this.tsbtnEmail = new System.Windows.Forms.ToolStripButton();
			this.tsbtnProperty = new System.Windows.Forms.ToolStripButton();
			this.tsbtnActOwner = new System.Windows.Forms.ToolStripButton();
			this.tsbtnAddParticipantRule = new System.Windows.Forms.ToolStripButton();
			this.splitContainer1 = new System.Windows.Forms.SplitContainer();
			this.panHuman = new System.Windows.Forms.Panel();
			this.panOrg = new System.Windows.Forms.Panel();
			this.orgControl1 = new OpenComposite.DesignerControls.CtrlSelectParticipant();
			this.pnlButtons = new System.Windows.Forms.Panel();
			this.rdoScopeAll = new System.Windows.Forms.RadioButton();
			this.rdoScopeFirst = new System.Windows.Forms.RadioButton();
			this.btnRemove = new System.Windows.Forms.Button();
			this.btnCancel = new System.Windows.Forms.Button();
			this.btnOk = new System.Windows.Forms.Button();
			this.btnAdd = new System.Windows.Forms.Button();
			this.btnOwner = new System.Windows.Forms.Button();
			this.btnProperty = new System.Windows.Forms.Button();
			this.btnEmail = new System.Windows.Forms.Button();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.lstParticipants = new System.Windows.Forms.ListView();
			this.contextSelected = new System.Windows.Forms.ContextMenuStrip(this.components);
			this.tsmiRemove = new System.Windows.Forms.ToolStripMenuItem();
			this.toolStripMain.SuspendLayout();
			this.splitContainer1.Panel1.SuspendLayout();
			this.splitContainer1.Panel2.SuspendLayout();
			this.splitContainer1.SuspendLayout();
			this.panHuman.SuspendLayout();
			this.panOrg.SuspendLayout();
			this.pnlButtons.SuspendLayout();
			this.groupBox1.SuspendLayout();
			this.contextSelected.SuspendLayout();
			this.SuspendLayout();
			// 
			// toolStripMain
			// 
			this.toolStripMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.tsbtnOK,
            this.tsbtnCancel,
            this.toolStripSeparator1,
            this.tsbtnEmail,
            this.tsbtnProperty,
            this.tsbtnActOwner,
            this.tsbtnAddParticipantRule});
			this.toolStripMain.Location = new System.Drawing.Point(0, 0);
			this.toolStripMain.Name = "toolStripMain";
			this.toolStripMain.Size = new System.Drawing.Size(632, 25);
			this.toolStripMain.TabIndex = 46;
			this.toolStripMain.Text = "Main";
			// 
			// tsbtnOK
			// 
			this.tsbtnOK.Image = global::OpenComposite.Repository.Properties.Resources.png_ok;
			this.tsbtnOK.Name = "tsbtnOK";
			this.tsbtnOK.Size = new System.Drawing.Size(43, 22);
			this.tsbtnOK.Text = "OK";
			this.tsbtnOK.Click += new System.EventHandler(this.tsbtnOK_Click);
			// 
			// tsbtnCancel
			// 
			this.tsbtnCancel.Image = global::OpenComposite.Repository.Properties.Resources.png_cancel;
			this.tsbtnCancel.Name = "tsbtnCancel";
			this.tsbtnCancel.Size = new System.Drawing.Size(63, 22);
			this.tsbtnCancel.Text = "Cancel";
			this.tsbtnCancel.Click += new System.EventHandler(this.tsbtnCancel_Click);
			// 
			// toolStripSeparator1
			// 
			this.toolStripSeparator1.Name = "toolStripSeparator1";
			this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
			// 
			// tsbtnEmail
			// 
			this.tsbtnEmail.Image = global::OpenComposite.Repository.Properties.Resources.bmp_mail;
			this.tsbtnEmail.ImageTransparentColor = System.Drawing.Color.Fuchsia;
			this.tsbtnEmail.Name = "tsbtnEmail";
			this.tsbtnEmail.Size = new System.Drawing.Size(131, 22);
			this.tsbtnEmail.Text = "Add E-Mail Address";
			this.tsbtnEmail.Click += new System.EventHandler(this.btnEmail_Click);
			// 
			// tsbtnProperty
			// 
			this.tsbtnProperty.Image = global::OpenComposite.Repository.Properties.Resources.property;
			this.tsbtnProperty.ImageTransparentColor = System.Drawing.Color.Fuchsia;
			this.tsbtnProperty.Name = "tsbtnProperty";
			this.tsbtnProperty.Size = new System.Drawing.Size(97, 22);
			this.tsbtnProperty.Text = "Add Property";
			this.tsbtnProperty.Click += new System.EventHandler(this.btnProperty_Click);
			// 
			// tsbtnActOwner
			// 
			this.tsbtnActOwner.Image = global::OpenComposite.Repository.Properties.Resources.png_user;
			this.tsbtnActOwner.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
			this.tsbtnActOwner.Name = "tsbtnActOwner";
			this.tsbtnActOwner.Size = new System.Drawing.Size(130, 22);
			this.tsbtnActOwner.Text = "Add Activity Owner";
			this.tsbtnActOwner.Click += new System.EventHandler(this.btnOwner_Click);
			// 
			// tsbtnAddParticipantRule
			// 
			this.tsbtnAddParticipantRule.Image = global::OpenComposite.Repository.Properties.Resources.png_participantrule;
			this.tsbtnAddParticipantRule.ImageTransparentColor = System.Drawing.Color.Magenta;
			this.tsbtnAddParticipantRule.Name = "tsbtnAddParticipantRule";
			this.tsbtnAddParticipantRule.Size = new System.Drawing.Size(135, 22);
			this.tsbtnAddParticipantRule.Text = "Add Participant Rule";
			this.tsbtnAddParticipantRule.Click += new System.EventHandler(this.tsbtnAddParticipantRule_Click);
			// 
			// splitContainer1
			// 
			this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
			this.splitContainer1.Location = new System.Drawing.Point(0, 25);
			this.splitContainer1.Name = "splitContainer1";
			// 
			// splitContainer1.Panel1
			// 
			this.splitContainer1.Panel1.Controls.Add(this.panHuman);
			// 
			// splitContainer1.Panel2
			// 
			this.splitContainer1.Panel2.Controls.Add(this.groupBox1);
			this.splitContainer1.Size = new System.Drawing.Size(632, 347);
			this.splitContainer1.SplitterDistance = 435;
			this.splitContainer1.TabIndex = 47;
			// 
			// panHuman
			// 
			this.panHuman.BackColor = System.Drawing.SystemColors.Control;
			this.panHuman.Controls.Add(this.panOrg);
			this.panHuman.Controls.Add(this.pnlButtons);
			this.panHuman.Dock = System.Windows.Forms.DockStyle.Fill;
			this.panHuman.Location = new System.Drawing.Point(0, 0);
			this.panHuman.Name = "panHuman";
			this.panHuman.Size = new System.Drawing.Size(435, 347);
			this.panHuman.TabIndex = 45;
			// 
			// panOrg
			// 
			this.panOrg.Controls.Add(this.orgControl1);
			this.panOrg.Dock = System.Windows.Forms.DockStyle.Fill;
			this.panOrg.Location = new System.Drawing.Point(0, 0);
			this.panOrg.Name = "panOrg";
			this.panOrg.Size = new System.Drawing.Size(435, 311);
			this.panOrg.TabIndex = 46;
			// 
			// orgControl1
			// 
			this.orgControl1.Dock = System.Windows.Forms.DockStyle.Fill;
			this.orgControl1.Location = new System.Drawing.Point(0, 0);
			this.orgControl1.Name = "orgControl1";
			this.orgControl1.Padding = new System.Windows.Forms.Padding(2);
			this.orgControl1.Size = new System.Drawing.Size(435, 311);
			this.orgControl1.TabIndex = 44;
			// 
			// pnlButtons
			// 
			this.pnlButtons.Controls.Add(this.rdoScopeAll);
			this.pnlButtons.Controls.Add(this.rdoScopeFirst);
			this.pnlButtons.Controls.Add(this.btnRemove);
			this.pnlButtons.Controls.Add(this.btnCancel);
			this.pnlButtons.Controls.Add(this.btnOk);
			this.pnlButtons.Controls.Add(this.btnAdd);
			this.pnlButtons.Controls.Add(this.btnOwner);
			this.pnlButtons.Controls.Add(this.btnProperty);
			this.pnlButtons.Controls.Add(this.btnEmail);
			this.pnlButtons.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.pnlButtons.Location = new System.Drawing.Point(0, 311);
			this.pnlButtons.Name = "pnlButtons";
			this.pnlButtons.Size = new System.Drawing.Size(435, 36);
			this.pnlButtons.TabIndex = 47;
			// 
			// rdoScopeAll
			// 
			this.rdoScopeAll.Checked = true;
			this.rdoScopeAll.Location = new System.Drawing.Point(70, 34);
			this.rdoScopeAll.Name = "rdoScopeAll";
			this.rdoScopeAll.Size = new System.Drawing.Size(113, 15);
			this.rdoScopeAll.TabIndex = 3;
			this.rdoScopeAll.TabStop = true;
			this.rdoScopeAll.Text = "Do Not Scope Role Assignment (Activity will be assigned to all members with this " +
				"role)";
			this.rdoScopeAll.Visible = false;
			// 
			// rdoScopeFirst
			// 
			this.rdoScopeFirst.Location = new System.Drawing.Point(5, 36);
			this.rdoScopeFirst.Name = "rdoScopeFirst";
			this.rdoScopeFirst.Size = new System.Drawing.Size(113, 17);
			this.rdoScopeFirst.TabIndex = 2;
			this.rdoScopeFirst.Text = "Scope Role Assignment Based On the First Activity.";
			this.rdoScopeFirst.Visible = false;
			// 
			// btnRemove
			// 
			this.btnRemove.Anchor = ( (System.Windows.Forms.AnchorStyles)( ( System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right ) ) );
			this.btnRemove.Location = new System.Drawing.Point(334, 6);
			this.btnRemove.Margin = new System.Windows.Forms.Padding(3, 3, 1, 3);
			this.btnRemove.Name = "btnRemove";
			this.btnRemove.Size = new System.Drawing.Size(97, 23);
			this.btnRemove.TabIndex = 40;
			this.btnRemove.Text = "&Remove";
			this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click);
			// 
			// btnCancel
			// 
			this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.btnCancel.Location = new System.Drawing.Point(167, 34);
			this.btnCancel.Margin = new System.Windows.Forms.Padding(3, 1, 3, 3);
			this.btnCancel.Name = "btnCancel";
			this.btnCancel.Size = new System.Drawing.Size(60, 15);
			this.btnCancel.TabIndex = 42;
			this.btnCancel.Text = "&Cancel";
			this.btnCancel.Visible = false;
			this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
			// 
			// btnOk
			// 
			this.btnOk.Location = new System.Drawing.Point(167, 46);
			this.btnOk.Name = "btnOk";
			this.btnOk.Size = new System.Drawing.Size(60, 15);
			this.btnOk.TabIndex = 41;
			this.btnOk.Text = "&OK";
			this.btnOk.Visible = false;
			this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
			// 
			// btnAdd
			// 
			this.btnAdd.Anchor = ( (System.Windows.Forms.AnchorStyles)( ( System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right ) ) );
			this.btnAdd.Location = new System.Drawing.Point(231, 6);
			this.btnAdd.Name = "btnAdd";
			this.btnAdd.Size = new System.Drawing.Size(97, 23);
			this.btnAdd.TabIndex = 33;
			this.btnAdd.Text = "&Add";
			this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
			// 
			// btnOwner
			// 
			this.btnOwner.Anchor = ( (System.Windows.Forms.AnchorStyles)( ( System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right ) ) );
			this.btnOwner.Location = new System.Drawing.Point(284, 36);
			this.btnOwner.Name = "btnOwner";
			this.btnOwner.Size = new System.Drawing.Size(44, 25);
			this.btnOwner.TabIndex = 36;
			this.btnOwner.Text = "Add Activity &Owner";
			this.btnOwner.Visible = false;
			this.btnOwner.Click += new System.EventHandler(this.btnOwner_Click);
			// 
			// btnProperty
			// 
			this.btnProperty.Anchor = ( (System.Windows.Forms.AnchorStyles)( ( System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right ) ) );
			this.btnProperty.Location = new System.Drawing.Point(334, 35);
			this.btnProperty.Name = "btnProperty";
			this.btnProperty.Size = new System.Drawing.Size(48, 25);
			this.btnProperty.TabIndex = 35;
			this.btnProperty.Text = "Add &Property";
			this.btnProperty.Visible = false;
			this.btnProperty.Click += new System.EventHandler(this.btnProperty_Click);
			// 
			// btnEmail
			// 
			this.btnEmail.Anchor = ( (System.Windows.Forms.AnchorStyles)( ( System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right ) ) );
			this.btnEmail.Location = new System.Drawing.Point(218, 35);
			this.btnEmail.Name = "btnEmail";
			this.btnEmail.Size = new System.Drawing.Size(60, 25);
			this.btnEmail.TabIndex = 34;
			this.btnEmail.Text = "Add &Email";
			this.btnEmail.Visible = false;
			this.btnEmail.Click += new System.EventHandler(this.btnEmail_Click);
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.lstParticipants);
			this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
			this.groupBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ( (byte)( 0 ) ));
			this.groupBox1.Location = new System.Drawing.Point(0, 0);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(193, 347);
			this.groupBox1.TabIndex = 43;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "Selected Participants";
			// 
			// lstParticipants
			// 
			this.lstParticipants.AllowDrop = true;
			this.lstParticipants.ContextMenuStrip = this.contextSelected;
			this.lstParticipants.Dock = System.Windows.Forms.DockStyle.Fill;
			this.lstParticipants.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ( (byte)( 0 ) ));
			this.lstParticipants.Location = new System.Drawing.Point(3, 16);
			this.lstParticipants.Name = "lstParticipants";
			this.lstParticipants.Size = new System.Drawing.Size(187, 328);
			this.lstParticipants.TabIndex = 0;
			this.lstParticipants.UseCompatibleStateImageBehavior = false;
			this.lstParticipants.View = System.Windows.Forms.View.List;
			this.lstParticipants.DragDrop += new System.Windows.Forms.DragEventHandler(this.lstParticipants_DragDrop);
			this.lstParticipants.DragEnter += new System.Windows.Forms.DragEventHandler(this.lstParticipants_DragEnter);
			this.lstParticipants.DragOver += new System.Windows.Forms.DragEventHandler(this.lstParticipants_DragOver);
			// 
			// contextSelected
			// 
			this.contextSelected.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.tsmiRemove});
			this.contextSelected.Name = "contextSelected";
			this.contextSelected.Size = new System.Drawing.Size(118, 26);
			this.contextSelected.Opening += new System.ComponentModel.CancelEventHandler(this.contextSelected_Opening);
			// 
			// tsmiRemove
			// 
			this.tsmiRemove.Image = global::OpenComposite.Repository.Properties.Resources.delete;
			this.tsmiRemove.Name = "tsmiRemove";
			this.tsmiRemove.Size = new System.Drawing.Size(117, 22);
			this.tsmiRemove.Text = "Remove";
			this.tsmiRemove.Click += new System.EventHandler(this.tsmiRemove_Click);
			// 
			// FormParticipants
			// 
			this.ClientSize = new System.Drawing.Size(632, 372);
			this.Controls.Add(this.splitContainer1);
			this.Controls.Add(this.toolStripMain);
			this.Icon = ( (System.Drawing.Icon)( resources.GetObject("$this.Icon") ) );
			this.MinimizeBox = false;
			this.MinimumSize = new System.Drawing.Size(350, 250);
			this.Name = "FormParticipants";
			this.ShowInTaskbar = false;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
			this.Text = "Select Participants";
			this.Closing += new System.ComponentModel.CancelEventHandler(this.FormParticipants_Closing);
			this.toolStripMain.ResumeLayout(false);
			this.toolStripMain.PerformLayout();
			this.splitContainer1.Panel1.ResumeLayout(false);
			this.splitContainer1.Panel2.ResumeLayout(false);
			this.splitContainer1.ResumeLayout(false);
			this.panHuman.ResumeLayout(false);
			this.panOrg.ResumeLayout(false);
			this.pnlButtons.ResumeLayout(false);
			this.groupBox1.ResumeLayout(false);
			this.contextSelected.ResumeLayout(false);
			this.ResumeLayout(false);
			this.PerformLayout();

		}


		#endregion


		#endregion Systemstuff


	}
}
